home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / bbs / s342q07.lha / verify.c < prev    next >
C/C++ Source or Header  |  1995-05-19  |  26KB  |  823 lines

  1. /*  Citadel Verify Database */
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include "ctdl.h"
  5. #include "c68door.h"
  6. extern CONFIG      cfg;            /* A buncha variables           */
  7. extern logBuffer   logBuf;         /* Pippul buffer                */
  8. extern FILE        *logfl;         /* log file descriptor          */
  9. extern LogTable    *logTab;
  10. extern int         thisLog;
  11. extern FILE            *netfl, *roomfl;
  12. extern NetBuffer   netBuf;
  13. extern NetTable    *netTab;
  14. extern rTable      *roomTab;         /* RAM index of rooms              */
  15. extern EVENT       *EventTab;      /* Events Table */
  16. void Process_Msg(MessageBuffer  *msg);
  17. void Do_Room_Stats(long total);
  18. void Print_Counts(struct counts *ptr );
  19. void Do_Message(MessageBuffer  *,int);
  20. void Verify_Messages(void);
  21. int MsgLen(MessageBuffer  *);
  22. void ShowHash(void);
  23. void showlog(int);
  24. char *LastOn(long lastdate, char s);
  25. void Do_Boolean(char *,short,short);
  26. void Verify_Config(void);
  27. void Verify_Log(void);
  28. void Verify_Room(void);
  29. void Verify_Events(void);
  30. void crashout(char *);
  31. void Check_codeBuf(char *,long,short);
  32. void Check_Shared(void);
  33. void Do_nflags(struct nflags *);
  34. void Do_Multi_Net_Data(MULTI_NET_DATA);
  35. void Do_Shared_Room(SharedRoom *);
  36. void Do_Door_Data(void);
  37. void Do_Net_Data(void);
  38. void Do_NetBuf_Data(int slot);
  39. short Vflag;   /* TRUE - Verbose output( config) */
  40. short Lflag;   /* TRUE - Verbose output( user log) */
  41. short Nflag;   /* TRUE - Verbose output( ctdlnet.sys ) */
  42. short Rflag;   /* TRUE - Verbose output( Room data ) */
  43. short Dflag;   /* TRUE - Verbose output(Doors data ) */
  44. short Mflag;   /* TRUE - Verbose output(Message data ) */
  45. short Eflag;   /* TRUE - Process Event data */
  46. char MControl;    /* selective dump control */
  47. int  mPrintf(char *format, ...) {return 0; }  /* stub to quiet the linker */
  48.  
  49.  
  50. void crashout(str)
  51. char *str;
  52.   {
  53.   printf(str);
  54.   exit(10);
  55.  
  56.   }
  57. int  main(int,char **);
  58. int  main(argc,argv)
  59. int  argc;
  60. char **argv;
  61.   {
  62.   SYS_FILE fn;
  63.   /* Process CONFIG  */
  64.   cfg.weAre = UTILITY;
  65.   if( argc > 1 )
  66.     {
  67.     Eflag = Dflag = Rflag = Vflag = Lflag = Mflag = Nflag = FALSE;
  68.     MControl = '\0';
  69.     }
  70.   else Eflag = Dflag = Rflag = Vflag = Lflag = Mflag = Nflag = TRUE;  /* default is all */
  71.   printf("Citadel Verify Database Utility Version 3.42 V1.03\n");
  72.   for( ;--argc>0; )
  73.     {
  74.     if( *argv[argc] == '-' )
  75.       {
  76.       switch ( argv[argc][1])
  77.         {
  78.         case 'l' :
  79.         case 'L' : Lflag = TRUE;break;
  80.         case 'e' :
  81.         case 'E' : Eflag = TRUE;break;
  82.         case 'v' :
  83.         case 'V' : Vflag = TRUE;break;
  84.         case 'r' :
  85.         case 'R' : Rflag = TRUE;break;
  86.         case 'n' :
  87.         case 'N' : Nflag = TRUE;break;
  88.         case 'm' :
  89.         case 'M' : Mflag = TRUE;MControl = argv[argc][2];break;
  90.         case 'd' :
  91.         case 'D' : Dflag = TRUE;break;
  92.         case 'a' :
  93.         case 'A' : Mflag = Eflag = Dflag = Lflag = Vflag = Rflag = Nflag = TRUE;break;
  94.         default:
  95.         printf("illegal option ignored:%s\n",argv[argc]);
  96.         printf(" Valid options are:\n");
  97.         printf("   -L User Log data  -V config data\n");
  98.         printf("   -R room data      -M Messages data\n");
  99.         printf("   -N net data       -E Event data\n");
  100.         printf("   -D Door Data      -A All of the Above\n");
  101.         };
  102.  
  103.       };
  104.  
  105.     };
  106.   if (!readSysTab(FALSE, TRUE)) exit(100);
  107.   Verify_Config();             /* Verify the data in the main database */
  108.   /* Process the User Log */
  109.   sprintf(fn, "%sctdllog.sys", &cfg.logArea);
  110.   if ((logfl = fopen(fn, "rb")) == NULL)
  111.     {
  112.     printf("Can't open the Citadel log!\n");
  113.     exit(1);
  114.  
  115.     }
  116.   initLogBuf(&logBuf);
  117.   Verify_Log();
  118.   if( cfg.BoolFlags.netParticipant )
  119.     {
  120.     /* process network information */
  121.     sprintf(fn, "%sctdlnet.sys", &cfg.netArea);
  122.     openFile(fn, &netfl);
  123.     initNetBuf(&netBuf);
  124.  
  125.     };
  126.   /* open room file */
  127.   sprintf(fn, "%sctdlroom.sys", &cfg.roomArea);
  128.   openFile(fn, &roomfl);
  129.   Verify_Room();
  130.   fclose(roomfl);
  131.   /* close room file */
  132.   Do_Door_Data();
  133.   Verify_Messages();    /* process the messages */
  134.   Verify_Events();      /* Event Data processing */
  135.   return 0;
  136.   }
  137.  
  138. struct  namelist
  139.   {
  140.   char *GenName;
  141.   int  GenVal;
  142.  
  143.   };
  144.  
  145. typedef struct namelist GenList;
  146.  
  147.   /***  INDENT-OFF ***/
  148. #define MAXDAYS  (8)
  149. #define MAXTYPES (3)
  150.  
  151. static GenList EvnDays[MAXDAYS] =
  152.   {
  153.     {    "Sun", SUNDAYS     },    {    "Mon", MONDAYS     },
  154.     {    "Tue", TUESDAYS    },    {    "Wed", WEDNESDAYS  },
  155.     {    "Thu", THURSDAYS   },    {    "Fri", FRIDAYS     },
  156.     {    "Sat", SATURDAYS   },    {    "All", ALL_DAYS    }
  157.   };
  158.  
  159. static GenList EvnTypes[MAXTYPES] =
  160.   {
  161.     {    "preempt",     TYPREEMPT  },    {    "non-preempt", TYNON      },
  162.     {    "quiet",       TYQUIET    }
  163.   };
  164.  
  165.  
  166. static GenList EvCls[EVENT_CLASS_COUNT] =
  167.   {
  168.     {    "network",             CLNET        },
  169.     {    "external",            CLEXTERN     },
  170.     {    "relative",            CLREL        },
  171.     {    "dl-time",             CL_DL_TIME   },
  172.     {    "anytime-net",         CL_ANYTIME_NET   },
  173.     {    "door-limit",          CL_DOOR_TIME },
  174.     {    "autodoor",            CL_AUTODOOR  },
  175.     {    "chat-on",             CL_CHAT_ON   },
  176.     {    "chat-off",            CL_CHAT_OFF  },
  177.     {    "redirect",            CL_REDIRECT  },
  178.     {    "newusers-allowed",    CL_NEWUSERS_ALLOWED   },
  179.     {    "newusers-disallowed", CL_NEWUSERS_DISALLOWED   },
  180.     {    "until-done-net",      CL_UNTIL_NET  },
  181.     {    "netcache",            CL_NETCACHE   },
  182.     };
  183.  
  184.  /**  INDENT-ON **/
  185. char *fake = "Unknown nnn  ";
  186.  
  187. char *Look_Up(int value,  GenList list[], int limit )
  188.  {
  189.  int i;
  190.  for( i=0; i<limit; i++) if( list[i].GenVal == value ) return list[i].GenName;
  191.  sprintf(&fake[8],"%3d",value);
  192.  return fake;
  193.  }
  194.  
  195. void Verify_Events()
  196.   {
  197.   int i,j;
  198.   int hrs,mins;
  199.   long minutes;
  200.   int day;
  201.   if( !Eflag )return;  /* exit if not requested */
  202.   printf("\n\nThere are %d events\n",cfg.EvNumber);
  203.   for( i=0; i< cfg.EvNumber; i++)
  204.     {
  205.     hrs = EventTab[i].EvDur / 60;
  206.     mins= EventTab[i].EvDur % 60;
  207.     printf("\nEvent Number: %d Duration:%d(%d:%02.2d)   ",i,EventTab[i].EvDur, hrs, mins);
  208.     printf("Event Type: %s\n", Look_Up(EventTab[i].EvType,EvnTypes,MAXTYPES) );
  209.     printf("Event Warning:%s\n",( cfg.codeBuf+EventTab[i].EvWarn) );
  210.     printf("Event Class:%s   ",Look_Up(EventTab[i].EvClass,EvCls,EVENT_CLASS_COUNT) );
  211.     printf("Event EvExitVal:%08.8lX :",EventTab[i].EvExitVal);
  212.     for (j = 0; j < 32; j++)
  213.       {
  214.       if (( 1l << j ) & EventTab[i].EvExitVal) printf("%d ", j + 1);
  215.       };
  216.     printf("\n");
  217.     hrs = EventTab[i].EvDur / 60;
  218.     mins= EventTab[i].EvDur % 60;
  219.     printf("Event Minutes: %d(%d:%02.2d)\n",EventTab[i].EvMinutes, hrs, mins);
  220.     day = 1;
  221.     minutes = EventTab[i].EvMinutes;
  222.     while( minutes >= 1440)
  223.       {
  224.       day <<= 1;
  225.       minutes -= 1440;
  226.       };
  227.     hrs = minutes / 60;
  228.     mins= minutes % 60;
  229.     printf("Event Day: %s  Start Time:%ld(%d:%02.2d)\n",Look_Up(day,EvnDays, MAXDAYS), minutes, hrs, mins);
  230.     switch (EventTab[i].EvClass)
  231.       {
  232.       case CL_ANYTIME_NET:
  233.         printf("Anytime DeadTime: %ld  Anytime Duration: %d\n",
  234.         EventTab[i].vars.Anytime.EvDeadTime, EventTab[i].vars.Anytime.EvAnyDur);
  235.         break;
  236.       case CL_AUTODOOR:
  237.         printf("AutoDoor for User:%s\n", EventTab[i].vars.EvUserName);
  238.         break;
  239.       case CL_REDIRECT:
  240.         printf("Redirect incoming: System:%s\n"
  241.         ,EventTab[i].vars.Redirect.EvSystem);
  242.         printf("Directory:%s Filename:%s\n",
  243.         (EventTab[i].vars.Redirect.EvHomeDir + cfg.codeBuf)
  244.         ,EventTab[i].vars.Redirect.EvFilename);
  245.         break;
  246.       };
  247.     };
  248.   }
  249.  
  250.  
  251.  
  252. void Verify_Room()
  253.   {
  254.   short Index;
  255.   for (Index = 0; Index < MAXROOMS; Index++)
  256.     {
  257.     if( Rflag )printf("\nRoom Slot #%d:",Index);
  258.     if(   roomTab[Index].rtflags.INUSE )
  259.       {
  260.       if( Index < 3 )
  261.         {
  262.         if( roomTab[Index].rtFlIndex != 0 )
  263.           {
  264.           printf("\nInitial Room not on Base Floor!\n");
  265.  
  266.           };
  267.  
  268.         };
  269.       if( Rflag )
  270.         {
  271.         printf("%20s Last Message:%ld Last Netted message:%ld\n",
  272.         roomTab[Index].rtname,roomTab[Index].rtlastMessage,roomTab[Index].rtlastNet);
  273.         printf("Floor Index:%d\n", roomTab[Index].rtFlIndex);
  274.         Do_Boolean("Public            ",roomTab[Index].rtflags.PUBLIC,         FALSE);
  275.         Do_Boolean("Directory         ",roomTab[Index].rtflags.ISDIR,          FALSE);
  276.         Do_Boolean("Permanent         ",roomTab[Index].rtflags.PERMROOM,       TRUE);
  277.         Do_Boolean("Skipped           ",roomTab[Index].rtflags.SKIP,           FALSE);
  278.         Do_Boolean("Uploadable        ",roomTab[Index].rtflags.UPLOAD,         FALSE);
  279.         Do_Boolean("Downloadable      ",roomTab[Index].rtflags.DOWNLOAD,       TRUE);
  280.         Do_Boolean("Shared            ",roomTab[Index].rtflags.SHARED,         FALSE);
  281.         Do_Boolean("Archived          ",roomTab[Index].rtflags.ARCHIVE,        FALSE);
  282.         Do_Boolean("Anonymous         ",roomTab[Index].rtflags.ANON,           TRUE);
  283.         Do_Boolean("Net Downloadable  ",roomTab[Index].rtflags.NO_NET_DOWNLOAD,FALSE);
  284.         Do_Boolean("Invitational      ",roomTab[Index].rtflags.INVITE,         FALSE);
  285.         Do_Boolean("Automaticly Netted",roomTab[Index].rtflags.AUTO_NET,       TRUE);
  286.         Do_Boolean("All Users Netted  ",roomTab[Index].rtflags.ALL_NET,        FALSE);
  287.         Do_Boolean("Read Only         ",roomTab[Index].rtflags.READ_ONLY,      TRUE);
  288.  
  289.         };
  290.  
  291.       }
  292.     else if( Rflag )printf(" Not in use at this time\n");
  293.  
  294.     };
  295.   if( Nflag )Check_Shared();
  296.  
  297.   }
  298. void Do_Net_Data()
  299.   {
  300.   printf("\nNode Name:%-22s  Node Id: %s\n",netBuf.netName, netBuf.netId);
  301.   printf("Short Name:%c%c%c  Passwords: Our(%s) Their(%s)\n",
  302.   (isprint(netBuf.nbShort[0]) ? netBuf.nbShort[0] : '*'),
  303.   (isprint(netBuf.nbShort[1]) ? netBuf.nbShort[1] : '*'),
  304.   (isprint(netBuf.nbShort[2]) ? netBuf.nbShort[2] : '*'),
  305.   netBuf.OurPwd, netBuf.TheirPwd);
  306.   printf("baudCode:%c nbGen: %c access:%s\n",
  307.   netBuf.baudCode, netBuf.nbGen, netBuf.access);
  308.   printf("nbRoute:%d nbRouteGen:%d nbHiRouteInd: %d nbLastConnect: %x\n",
  309.   netBuf.nbRoute, netBuf.nbRouteGen, netBuf.nbHiRouteInd, netBuf.nbLastConnect);
  310.   }
  311.  
  312. void Check_Shared()
  313.   {
  314.   short netrover;
  315.   for( netrover=0; netrover < cfg.netSize; netrover++)
  316.     {
  317.     getNet(netrover,&netBuf);
  318.     Do_NetBuf_Data(netrover);
  319.     printf("\nnetTab[%d]:",netrover);
  320.     if( netTab[netrover].ntflags.in_use )
  321.       {
  322.       printf(" In use\n");
  323.       printf(" ntnmhash: %d  ntidhash: %d  Short name:%c%c%c Generation: %d\n",
  324.       netTab[netrover].ntnmhash,netTab[netrover].ntidhash,
  325.       (isprint(netTab[netrover].ntShort[0]) ? netTab[netrover].ntShort[0] : '*'),
  326.       (isprint(netTab[netrover].ntShort[1]) ? netTab[netrover].ntShort[1] : '*'),
  327.       (isprint(netTab[netrover].ntShort[2]) ? netTab[netrover].ntShort[2] : '*'),
  328.       netTab[netrover].ntGen);
  329.       Do_nflags(&netTab[netrover].ntflags);
  330.       Do_Multi_Net_Data(netTab[netrover].ntMemberNets);
  331.       Do_Shared_Room(netTab[netrover].netTRooms);
  332.       Do_Net_Data();
  333.       }
  334.     else
  335.       {
  336.       printf("Not in use\n");
  337.  
  338.       };
  339.  
  340.     };
  341.  
  342.   }
  343. void Do_nflags(ntflags)
  344. struct nflags *ntflags;
  345.   {
  346.   Do_Boolean("normal_mail   ",ntflags->normal_mail,FALSE);
  347.   Do_Boolean("in_use        ",ntflags->in_use,FALSE);
  348.   Do_Boolean("room_files    ",ntflags->room_files,TRUE);
  349.   Do_Boolean("local         ",ntflags->local,FALSE);
  350.   Do_Boolean("spine         ",ntflags->spine,FALSE);
  351.   Do_Boolean("send_files    ",ntflags->send_files,TRUE);
  352.   Do_Boolean("is_spine      ",ntflags->is_spine,FALSE);
  353.   Do_Boolean("OtherNet      ",ntflags->OtherNet,FALSE);
  354.   Do_Boolean("HasRouted     ",ntflags->HasRouted,TRUE);
  355.   Do_Boolean("RouteFor      ",ntflags->RouteFor,FALSE);
  356.   Do_Boolean("RouteTo       ",ntflags->RouteTo,FALSE);
  357.   Do_Boolean("Stadel        ",ntflags->Stadel,TRUE);
  358.   Do_Boolean("RouteLock     ",ntflags->RouteLock,FALSE);
  359.   Do_Boolean("ExternalDialer",ntflags->ExternalDialer,FALSE);
  360.   Do_Boolean("NoDL          ",ntflags->NoDL,TRUE);
  361.   Do_Boolean("MassTransfer  ",ntflags->MassTransfer,FALSE);
  362.   Do_Boolean("Lzh           ",ntflags->Lzh,FALSE);
  363.   Do_Boolean("Zoo           ",ntflags->Zoo,TRUE);
  364.   Do_Boolean("Arc           ",ntflags->Arc,FALSE);
  365.  
  366.   }
  367. void Do_Multi_Net_Data(MN)
  368. MULTI_NET_DATA MN;
  369.   {
  370.   short i;
  371.   printf(" Member of Nets:");
  372.   for(i=0; i<MAX_NET-1;i++) if( ((1<<i) & MN) !=0 )printf(" %d",i+1);
  373.   printf("\n");
  374.   if( (MN & 0x80000000) != 0)printf("Priority Mail\n");
  375.  
  376.   }
  377. void Do_Shared_Room(nRms)
  378. SharedRoom *nRms;
  379.   {
  380.   int slot;
  381.   for(slot = 0; slot < SHARED_ROOMS; slot++)
  382.     {
  383.     if( (nRms->srgen & 0x8000) )
  384.       {
  385.       printf(" \nSR[%d]:  lM:%ld  Mode:",slot,  nRms->lastMess);
  386.       switch (GetMode(nRms->mode))
  387.         {
  388.         case            PEON: printf("Peon            "); break;
  389.         case        REG_HOST: printf("Reg Host        "); break;
  390.         case        BACKBONE: printf("Backbone        "); break;
  391.         case   PASS_BACKBONE: printf("Passive Backbone"); break;
  392.         case ACTIVE_BACKBONE: printf("Active Backbone "); break;
  393.         default:              printf("Unknown");
  394.         };
  395.       printf("  F:%s srgen:%x srslot: %d",
  396.       (GetFA(nRms->mode) != 0 ? "YES":"NO "),nRms->srgen,nRms->srslot);
  397.       };
  398.       nRms++;
  399.     };
  400.   }
  401. void Check_codeBuf(str,data,control)
  402. char *str;
  403. long data;
  404. short control;   /* TRUE - Newline if verbose operation */
  405.   {
  406.   if( data >= MAXCODE )
  407.     {
  408.     printf("\nInvalid values(%d) for offset:%s\n",data,str);
  409.  
  410.     }
  411.   else
  412.     {
  413.     if(Vflag)
  414.       {
  415.       char *d;
  416.       d = &cfg.codeBuf[0];
  417.       printf("%-20s(%ld):%s%c",str,data,
  418.       (data == 0 ? "Undefined" : &d[data]),(control ? '\n':' '));
  419.  
  420.       };
  421.  
  422.     };
  423.  
  424.   }
  425. void Verify_Config()
  426.   {
  427.   short i;
  428.   if( Vflag )
  429.     {
  430.     printf("\nmaxMSector:%d ",cfg.maxMSector);
  431.     printf("Message Old::%ld New:%ld\n",cfg.oldest,cfg.newest);
  432.  
  433.     };
  434.   Check_codeBuf("Node Name",  cfg.nodeName,TRUE);
  435.   Check_codeBuf("Node Id",    cfg.nodeId,FALSE);
  436.   Check_codeBuf("Node Domain",cfg.nodeDomain,TRUE);
  437.   Check_codeBuf("Node Title", cfg.nodeTitle,TRUE);
  438.   Check_codeBuf("Main Floor", cfg.MainFloor,FALSE);
  439.   Check_codeBuf("Base Room",  cfg.bRoom, TRUE);
  440.   for(i=0;i<7;i++)
  441.     {
  442.     Check_codeBuf("Dial Prefix",cfg.DialPrefixes[i],TRUE);
  443.  
  444.     };
  445.   Check_codeBuf("Dial Suffix",cfg.netSuffix,TRUE);
  446.   if( Vflag )
  447.     {
  448.     printf("Max File:%d Area Size: %d receptArea:%s\n",
  449.     cfg.maxFileSize, cfg.sizeArea, &cfg.receptArea);
  450.     printf("Sysop:%s CryptSeed:%d InitColumns:%d LoginAttempts:%d Audit: %d(%s)\n",
  451.     cfg.SysopName,cfg.cryptSeed,cfg.InitColumns,cfg.LoginAttempts,
  452.     cfg.Audit,( cfg.Audit == 0 ? "None":(cfg.Audit == 1? "Normal":"No Net") ) );
  453.     printf("  homeArea:%s\n",&cfg.homeArea);
  454.     printf("   msgArea:%s\n",&cfg.msgArea);
  455.     printf("  msg2Area:%s\n",&cfg.msg2Area);
  456.     printf("   logArea:%s\n",&cfg.logArea);
  457.     printf("  roomArea:%s\n",&cfg.roomArea);
  458.     printf("   netArea:%s\n",&cfg.netArea);
  459.     printf("domainArea:%s\n",&cfg.domainArea);
  460.     printf(" auditArea:%s\n",&cfg.auditArea);
  461.     printf(" floorArea:%s\n",&cfg.floorArea);
  462.     printf("  holdArea:%s\n",&cfg.holdArea);
  463.     printf("sysBaud:%d netSiz:%d DomainHandlers:%d\n"
  464.     ,cfg.sysBaud,cfg.netSize,cfg.DomainHandlers);
  465.  
  466.     };
  467.   Check_codeBuf("Mail Hub",cfg.MailHub,TRUE);
  468.   if( Vflag )
  469.     {
  470.     printf("Domain display Format:%s\n",&cfg.DomainDisplay[0]);
  471.     printf("EvNumber:%d weAre:%d paramVers:%d\n",cfg.EvNumber,cfg.weAre,cfg.paramVers);
  472.     printf("MaxLog size:%d ",cfg.MAXLOGTAB);
  473.     printf("Mail  Slots:%d ",cfg.MailSlots);
  474.     printf("Msgs Per room:%d\n",cfg.MsgsPerrm);
  475.     printf("Max Rooms:%d ",cfg.MaxRooms);
  476.     printf("Shared Rooms:%d\n",cfg.SharedRooms);
  477.     printf("Next msg slot: %d/%d Anon Mail Max Length:%d\n",
  478.     cfg.catChar,cfg.catSector,cfg.AnonMailLength);
  479.     printf("Log entries are %d in size\n",cfg.sizeLTentry);
  480.     printf("Console Timeout:%d\n",cfg.ConTimeOut);
  481.     printf("Sysop Archive:%s\n",cfg.SysopArchive);
  482.     Do_Boolean("HoldOnLost    ", cfg.BoolFlags.HoldOnLost    ,FALSE);
  483.     Do_Boolean("mirror        ", cfg.BoolFlags.mirror        ,FALSE);
  484.     Do_Boolean("unlogEnterOk  ", cfg.BoolFlags.unlogEnterOk  ,TRUE);
  485.     Do_Boolean("unlogReadOk   ", cfg.BoolFlags.unlogReadOk   ,FALSE);
  486.     Do_Boolean("nonAideRoomOk ", cfg.BoolFlags.nonAideRoomOk ,FALSE);
  487.     Do_Boolean("noMail        ", cfg.BoolFlags.noMail        ,TRUE);
  488.     Do_Boolean("noChat        ", cfg.BoolFlags.noChat        ,FALSE);
  489.     Do_Boolean("netParticipant", cfg.BoolFlags.netParticipant,FALSE);
  490.     Do_Boolean("aideSeeAll    ", cfg.BoolFlags.aideSeeAll    ,TRUE);
  491.     Do_Boolean("debug         ", cfg.BoolFlags.debug         ,FALSE);
  492.     Do_Boolean("NetDft        ", cfg.BoolFlags.NetDft        ,FALSE);
  493.     Do_Boolean("SysopEditor   ", cfg.BoolFlags.SysopEditor   ,TRUE);
  494.     Do_Boolean("IsDoor        ", cfg.BoolFlags.IsDoor        ,FALSE);
  495.     Do_Boolean("RouteMail     ", cfg.BoolFlags.RouteMail     ,FALSE);
  496.     Do_Boolean("DoorDft       ", cfg.BoolFlags.DoorDft       ,TRUE);
  497.     Do_Boolean("AnonSessions  ", cfg.BoolFlags.AnonSessions  ,FALSE);
  498.     Do_Boolean("DL_Default    ", cfg.BoolFlags.DL_Default    ,FALSE);
  499.     Do_Boolean("NetScanBad    ", cfg.BoolFlags.NetScanBad    ,TRUE);
  500.     printf("SysOp Editor:%s\n",cfg.DepData.Editor);
  501.     printf("SysOp Editor Area:%s\n",cfg.DepData.EditArea);
  502.     printf("Sysdependant Modem:%s\n",cfg.DepData.ModemSetup);
  503.     printf("Sysdependant Modem Init:%s\n",cfg.DepData.HiSpeedInit);
  504.     printf("Sysdependant Modem Unit %d Device:%s\n"
  505.     , cfg.DepData.UnitNumber, cfg.DepData.DevName);
  506.     printf("Sysdependant clock:%d\n",cfg.DepData.Clock);
  507.     printf("Sysdependant Lockport:%d\n",cfg.DepData.LockPort);
  508.     printf("Sysdependant width: %d Height: %d Depth: %d\n",
  509.     cfg.DepData.ScreenWidth,cfg.DepData.ScreenHeight,cfg.DepData.ScreenDepth);
  510.     printf("Sysdependant Colors:%d %d\n",cfg.DepData.Color0, cfg.DepData.Color1);
  511.  
  512.     };
  513.  
  514.   }
  515. void Do_Boolean(str,flag,control)
  516. char *str;
  517. short flag,control;
  518.   {
  519.   printf("%s: %s%c",str,(flag!=0 ? "Yes  " : "No   "),(control ? '\n' : ' ') );
  520.  
  521.   }
  522. void Verify_Log()
  523.   {
  524.   short i;
  525.   initLogBuf(&logBuf);
  526.   for ( i = 0; i < cfg.MAXLOGTAB; i++ )
  527.     {
  528.     getLog(&logBuf,i);
  529.     if( Lflag )printf("\nlog:%-4d",i);
  530.     if (logBuf.lbflags.L_INUSE)
  531.       {
  532.       showlog(i);
  533.       if( logBuf.lbwidth < 40 || logBuf.lbwidth > 132 )
  534.         {
  535.         printf("Log:%d,  %s terminal width = %d\n",i,logBuf.lbname,logBuf.lbwidth);
  536.  
  537.         };
  538.       if( logBuf.lbnulls > 50 )
  539.         {
  540.         printf("Log:%d,  %s terminal nulls = %d\n",i,logBuf.lbname,logBuf.lbnulls);
  541.  
  542.         };
  543.       if( logBuf.credit < 0 || logBuf.credit > 1000)
  544.         {
  545.         printf("Log:%d,  %s Long Distance credits = %d\n",i,logBuf.lbname,logBuf.credit);
  546.  
  547.         };
  548.  
  549.       }
  550.     else
  551.       {
  552.       if( Lflag )printf(" Not in use at this time\n");
  553.  
  554.       };
  555.  
  556.     };
  557.  
  558.   }
  559. void showlog(i)
  560. int i;
  561.   {
  562.   if( Lflag )
  563.     {
  564.     printf("%4d: %-20s",i,logBuf.lbname);
  565.     printf("%-20s",logBuf.lbpw);
  566.     ShowHash();
  567.     printf(" %d col. Last Call:%s\n",logBuf.lbwidth, LastOn(logBuf.lblaston, TRUE));
  568.     Do_Boolean("AIDE Status       ",logBuf.lbflags.AIDE      ,FALSE);
  569.     Do_Boolean("Expert User       ",logBuf.lbflags.EXPERT    ,FALSE);
  570.     Do_Boolean("Network Privilege ",logBuf.lbflags.NET_PRIVS ,TRUE);
  571.     Do_Boolean("Door Privilege    ",logBuf.lbflags.DOOR_PRIVS,FALSE);
  572.     Do_Boolean("Download Privilege",logBuf.lbflags.DL_PRIVS  ,FALSE);
  573.     Do_Boolean("Permanent Account ",logBuf.lbflags.PERMANENT ,TRUE);
  574.     Do_Boolean("Floor mode        ",logBuf.lbflags.FLOORS    ,FALSE);
  575.     Do_Boolean("TWIT User         ",logBuf.lbflags.TWIT      ,FALSE);
  576.     Do_Boolean("RUGGIE User       ",logBuf.lbflags.RUGGIE    ,TRUE);
  577.     Do_Boolean("Active Account    ",logBuf.lbflags.L_INUSE   ,FALSE);
  578.     Do_Boolean("LF FLAG           ",logBuf.lbflags.LFMASK    ,FALSE);
  579.     Do_Boolean("OLD STYLE         ",logBuf.lbflags.OLDTOO    ,TRUE);
  580.     Do_Boolean("HALF DUPLEX       ",logBuf.lbflags.HALF_DUP  ,FALSE);
  581.     Do_Boolean("ALT. Read Messages",logBuf.lbflags.ALT_RE    ,FALSE);
  582.     Do_Boolean("Room Name Prompt  ",logBuf.lbflags.NoPrompt  ,TRUE);
  583.  
  584.     };
  585.  
  586.   }
  587. void ShowHash()
  588.   {
  589.   int i;
  590.   for (i = 0; i < cfg.MAXLOGTAB; i++)
  591.   if (logTab[i].ltlogSlot == thisLog)
  592.     {
  593.     printf("ltab=%02d, hash=%02d\n ", logTab[i].ltpwhash, hash(logBuf.lbpw));
  594.  
  595.     }
  596.  
  597.   }
  598. void Do_Door_Data()
  599.   {
  600.   FILE        *fd;
  601.   SYS_FILE    name;
  602.   DoorData    DoorInfo;
  603.   extern char *READ_ANY;
  604.   short flag;
  605.   makeSysName(name, DOOR_DATA, &cfg.roomArea);
  606.   if ((fd = safeopen(name, READ_ANY)) == NULL)
  607.     {
  608.     if( Dflag )printf("No doors appear to be available.\n ");
  609.     return;
  610.  
  611.     };
  612.   /* process each door */
  613.   while ( fread((char *)&DoorInfo, sizeof DoorInfo, 1, fd) != 0)
  614.     {
  615.     if( Dflag)
  616.       {
  617.       printf("\nDoor Code:%s Program:%s Room:%s\n"
  618.       ,DoorInfo.entrycode,DoorInfo.program,DoorInfo.RoomName);
  619.       printf("Parameters:%s\n",DoorInfo.parameters);
  620.       printf("Description:%s\n",DoorInfo.description);
  621.       printf("Location:%s TimeLimit:%d\n",DoorInfo.location,DoorInfo.TimeLimit);
  622.       flag = (DOOR_AIDE    & DoorInfo.flags) ? 1:0;
  623.       Do_Boolean("   AIDE",flag,FALSE);
  624.       flag = (DOOR_SYSOP   & DoorInfo.flags) ? 1:0;
  625.       Do_Boolean("  SYSOP",flag,FALSE);
  626.       flag = (DOOR_CON     & DoorInfo.flags) ? 1:0;
  627.       Do_Boolean("Console",flag,TRUE);
  628.       flag = (DOOR_MODEM   & DoorInfo.flags) ? 1:0;
  629.       Do_Boolean("  Modem",flag,FALSE);
  630.       flag = (DOOR_AUTO    & DoorInfo.flags) ? 1:0;
  631.       Do_Boolean("   Auto",flag,FALSE);
  632.       flag = (DOOR_NEWUSER & DoorInfo.flags) ? 1:0;
  633.       Do_Boolean("NewUser",flag,TRUE);
  634.       printf("\n");
  635.  
  636.       };
  637.  
  638.     };
  639.  
  640.   }
  641. /*
  642. * doMessages()
  643. *
  644. * This function loops thru the msg file until finished.  It accumulates
  645. * statistics, etc.
  646. */
  647. extern MessageBuffer  msgBuf; /* The -sole- message buffer      */
  648. extern FILE *msgfl, *msgfl2;
  649.  
  650. struct counts
  651.   {
  652.   struct counts *next;
  653.   char name[20];    /* room name */
  654.   long  messages;   /* number of messages in the room */
  655.   long bytes;       /* total space the message uses */
  656.  
  657.   };
  658. struct counts *Header;
  659.  
  660. void Process_Msg(MessageBuffer  *msg)
  661.   {
  662.   struct counts *ptr, *uptr;
  663.   int done;
  664. /*
  665. ** User names Statistics
  666. */
  667.   if( Header = NULL )
  668.     {
  669.     Header = ptr = malloc(sizeof(struct counts));
  670.     strcpy(ptr->name, msg->mbauth);
  671.     ptr->messages = 0;
  672.     ptr->bytes    = 0;
  673.     ptr->next     = NULL;
  674.     }
  675.   else
  676.     {
  677.     ptr = Header;
  678.     done= FALSE;
  679.     while( ptr != NULL && !done)
  680.       {
  681.       if( strcmp(msg->mbauth,ptr->name)== 0 )done=TRUE;
  682.       if( !done )
  683.         {
  684.         uptr = ptr;
  685.         ptr = ptr->next;
  686.         };
  687.       };
  688.     };
  689.   if( ptr == NULL )
  690.     {
  691.     ptr = malloc(sizeof(struct counts));
  692.     strcpy(ptr->name, msg->mbauth);
  693.     ptr->messages = 0;
  694.     ptr->bytes    = 0;
  695.     ptr->next     = NULL;
  696.     uptr->next    = ptr;
  697.     };
  698.   ptr->messages++;
  699.   ptr->bytes += MsgLen(msg);
  700. /*
  701. ** Room Statistics
  702. */
  703.   ptr = Header;
  704.   done= FALSE;
  705.   while( ptr != NULL && !done)
  706.     {
  707.     if( strcmp(msg->mbroom,ptr->name)== 0 )done=TRUE;
  708.     if( !done )
  709.       {
  710.       uptr = ptr;
  711.       ptr = ptr->next;
  712.       };
  713.     };
  714.   if( ptr == NULL )
  715.     {
  716.     ptr = malloc(sizeof(struct counts));
  717.     strcpy(ptr->name, msg->mbauth);
  718.     ptr->messages = 0;
  719.     ptr->bytes    = 0;
  720.     ptr->next     = NULL;
  721.     uptr->next    = ptr;
  722.     };
  723.   ptr->messages++;
  724.   ptr->bytes += MsgLen(msg);
  725.  
  726.   }
  727.  
  728. void Print_Counts(struct counts *ptr )
  729.   {
  730.   if( ptr != NULL )
  731.     {
  732.     if( ptr->messages <= 0)ptr->messages = 1;
  733.     printf("Name:%20s Messages:%10ld Bytes:%10ld Aver:%10ld\n"
  734.     ,ptr->name,ptr->messages, ptr->bytes, ptr->bytes/ptr->messages);
  735.     Print_Counts(ptr->next);
  736.     };
  737.   }
  738.  
  739. void Do_Room_Stats(long total)
  740.   {
  741.   printf("Total of %ld messages\n",total);
  742.   Print_Counts( Header );
  743.   }
  744.  
  745. void Verify_Messages()
  746.   {
  747.   MSG_NUMBER msg, firstMessage;
  748.   MSG_NUMBER total;     /* For stat keeping. */
  749.   extern struct mBuf mFile1;
  750.   if( !Mflag ) return;
  751.   Header = NULL;
  752.   fprintf(stderr, "Mulching...\n");
  753.   InitMsgBase();
  754.   startAt(msgfl, &mFile1, 0, 0);
  755.   getMessage(getMsgChar, FALSE, TRUE, TRUE);
  756.   firstMessage = atol(msgBuf.mbId);
  757.   Do_Message(&msgBuf,TRUE);
  758.   msg = firstMessage -1;
  759.   total = 0;
  760.   while (msg != firstMessage)
  761.     {
  762.     total++;
  763.     getMessage(getMsgChar, FALSE, TRUE, TRUE);
  764.     Do_Message(&msgBuf, FALSE);
  765.     msg = atol(msgBuf.mbId);
  766.  
  767.     }
  768.   Do_Room_Stats(total);
  769.  
  770.   }
  771. void Do_Message(MessageBuffer  *msg, int flag)
  772.   {
  773.   Process_Msg(msg);
  774.   if( MControl == 'A')
  775.     {
  776.     printf("\nMsg: %6d Sector ID: %6d Author:%s To:%s "
  777.     ,  msg->mbheadChar, msg->mbheadSector, msg->mbauth, msg->mbto);
  778.     printf("Name:%s ID:%s Room:%s\n",  msg->mboname,  msg->mborig,  msg->mbroom);
  779.     }
  780.   else
  781.     {
  782.     printf("Message %6d Sector ID: %6d Author:%s\n",  msg->mbheadChar, msg->mbheadSector, msg->mbauth);
  783.     printf("Date:%20s Time:%20s Local Id:%20s\n",  msg->mbdate,  msg-> mbtime,  msg-> mbId);
  784.     printf("Human:%20s ID:%20s Room:%20s\n",  msg->mboname,  msg->mborig,  msg->mbroom);
  785.     printf("Origin:%20s To:%20s\n",  msg->mbsrcId,  msg->mbto);
  786.     printf("Route:%s\n", msg->mbaddr);
  787.     printf("OtherNet:%s\n",msg->mbOther);
  788.     printf("reply:%20s Domain:%20s\n",msg->mbreply, msg->mbdomain);
  789.     };
  790.   }
  791. /*
  792. * MsgLen()
  793. *
  794. * This function figures out the byte usage of the message.
  795. */
  796. int MsgLen(MessageBuffer  *msg)
  797.   {
  798.   return  (int) (       strlen(msg->mbtext)  + strlen(msg->mbauth) +
  799.   strlen(msg->mbdate)  + strlen(msg->mbtime) +
  800.   strlen(msg->mbId)    + strlen(msg->mboname) +
  801.   strlen(msg->mborig)  + strlen(msg->mbroom) +
  802.   strlen(msg->mbsrcId) + strlen(msg->mbto) +
  803.   strlen(msg->mbaddr)  + strlen(msg->mbOther) );
  804.  
  805.   }
  806. void Do_NetBuf_Data(int slot)
  807.   {
  808.   printf("\nSlot:%2d Node Name:%-22s  Node Id: %s\n",slot,netBuf.netName, netBuf.netId);
  809.   printf("Short Name:%c%c%c  Passwords: Our(%s) Their(%s)\n",
  810.   (isprint(netBuf.nbShort[0]) ? netBuf.nbShort[0] : '*'),
  811.   (isprint(netBuf.nbShort[1]) ? netBuf.nbShort[1] : '*'),
  812.   (isprint(netBuf.nbShort[2]) ? netBuf.nbShort[2] : '*'),
  813.   netBuf.OurPwd, netBuf.TheirPwd);
  814.   printf("baudCode:%d nbGen: %d access:%s\n",
  815.   (int)netBuf.baudCode, (int)netBuf.nbGen, netBuf.access);
  816.   printf("nbRoute:%d nbRouteGen:%d nbHiRouteInd: %d nbLastConnect: %x\n",
  817.   netBuf.nbRoute, netBuf.nbRouteGen, netBuf.nbHiRouteInd, netBuf.nbLastConnect);
  818.   Do_nflags(&netBuf.nbflags);
  819.   Do_Multi_Net_Data(netBuf.MemberNets);
  820.   Do_Shared_Room(netBuf.netRooms);
  821.  
  822.   }
  823.